package com.jesper.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jesper.model.Role;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface RoleMapper extends BaseMapper<Role> {

    @Select("select role from tb_user where id = #{id}")
    String getRoleById(Integer id);

    @Select("select permission from tb_permission where id in (select permission_id from tb_role_permission where role_id = #{roleId})")
    List<String> getAuthority(Integer roleId);
}
